# -*- coding: utf-8 -*-
# @Time    : 2024/8/30 14:00
# @Author  : qd
# @Email   : 1518603573@qq.com
# @File    : fiance_ysk_add_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from selenium.webdriver.common.by import By
"""添加应收款界面"""
class YskAddPage(BasePage):
    url = "/crm/index.php?m=finance&a=add&t=receivables"
    """应收款名输入框定位器"""
    ysk_input_name_locator = (By.ID, "name")
    """客户输入框定位器"""
    ysk_input_customer_locator = (By.ID, "customer")
    """选中客户定位器"""
    ysk_btn_customer_locator = (By.CSS_SELECTOR, "#datas > tr > td:nth-child(1) > input[type=radio]:nth-child(1)")
    """ok按钮定位器"""
    ysk_btn_ok_locator = (By.CSS_SELECTOR, "body > div:nth-child(8) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)")
    """负责人输入框定位器"""
    ysk_input_owner_locator = (By.ID, "owner_name")
    """商品价格输入框定位器"""
    ysk_input_price_locator = (By.ID, "price")
    """保存按钮定位器"""
    ysk_btn_submit_locator = (By.CSS_SELECTOR, "body > div.container > div.row > div > form > table > tfoot > tr > td:nth-child(2) > input:nth-child(1)")

    """点击应收款按钮"""
    def input_ysk_name(self,ysk_name):
        self.driver.find_element(*self.ysk_input_name_locator).send_keys(ysk_name)

    """点击客户输入框"""
    def click_ysk_input_customer(self):
        self.driver.find_element(*self.ysk_input_customer_locator).click()

    """点击要选择的客户"""
    def click_ysk_btn_customer(self):
        self.driver.find_element(*self.ysk_btn_customer_locator).click()

    """点击OK"""
    def click_ysk_btn_ok(self):
        self.driver.find_element(*self.ysk_btn_ok_locator).click()

    """输入应收款金额"""
    def input_ysk_price(self,ysk_price):
        self.driver.find_element(*self.ysk_input_price_locator).send_keys(ysk_price)

    """点击保存"""
    def click_ysk_submit_btn(self):
        self.driver.find_element(*self.ysk_btn_submit_locator).click()





